

function getToken() {
	console.log('step into getToken()')
	var data = {
		grant_type: "client_credential",
		appid: "wx7c9f0ff5a75c4b79",
		secret: "d4624c36b6795d1d99dcf0547af5443d"
	};
	$.ajax({
		url: 'https://api.weixin.qq.com/cgi-bin/token',
		type: 'GET',
		dataType: 'json',
		data: data,
		success: function (r) {
			 console.log(r);
			 getDevice(r.access_token);

		},
		error: function (e) {
			console.log(e);
			//alert("error");
		}
	});
}
function getDevice(token) {
	console.log('step into getDevice()')	
	var data = {
		access_token: token
	};
	console.log(data)
	$.ajax({
		url: 'https://api.weixin.qq.com/device/getqrcode?access_token='+ token +'&product_id=39023',
		type: 'GET',
		dataType: 'json',
		data: data,
		success: function (r) {
			 console.log(r);			
		},
		error: function (e) {
			console.log(e);
			//alert("error");
		}
	});
}